//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#define PCI_VENDOR_CHIPSTECH    0x102C
static pciConfigPtr  pcrp;

int
ctPCIMemBase(Boolean ctisHiQV32)
{
    if (pcrp && pcrp->_vendor == PCI_VENDOR_CHIPSTECH) {
        if (pcrp->_base0 != 0) {
            return pcrp->_base0 & 0xFF800000;
        }
        else {
            kprintf("%s %s: %s: Can't find valid PCI Base Address\n", \
                    XCONFIG_PROBED, SvgaInfoRec.name, SvgaInfoRec.chipset);
            return -1;
        }
    } else {
        kprintf("%s %s: %s: Can't find PCI device in configuration space\n", \
                XCONFIG_PROBED, SvgaInfoRec.name, SvgaInfoRec.chipset);
        return -1;
    }

    return 0;
}

int
ctPCIChipset()
{
    int i = 0;
    int found = 0;

    if (!vgaPCIInfo)
        return (-1);

    while ((pcrp = vgaPCIInfo[i])) {
        if (pcrp->_vendor != PCI_VENDOR_CHIPSTECH) {
            i++;
        }
        else {
            found = 1;
            break;
        }
    }

    if (found == 1)
        return(pcrp->_device);
    else
        return 0;
}
